# -*- coding: utf-8 -*-
# 此处修改配置参数
from os import getenv, path

certs_path = path.join(path.dirname(__file__), "static/certs")


class Config(object):
    DEBUG = False # getenv("DEBUG", default=False)
    TESTING = False
    SECRET_KEY = "8f06129284964ee7822fad07b6795718"
    PORT = int(getenv("PORT", 9532))

    DB_ADDRESS = getenv("DB_ADDRESS", "localhost")
    DATABASE = getenv("DATABASE", "news_order")
    DB_USER = getenv("DB_USER", "root")
    DB_PASSWORD = getenv("DB_PASSWORD", "password")
    SQLALCHEMY_DATABASE_URI = "mysql+pymysql://%s:%s@%s:3306/%s?charset=utf8" % (
        DB_USER,
        DB_PASSWORD,
        DB_ADDRESS,
        DATABASE,
    )

    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SQLALCHEMY_POOL_SIZE = 10600
    SQLALCHEMY_POOL_TIMEOUT = 200
    SQLALCHEMY_POOL_RECYCLE = 10600

    REDIS_HOST = "localhost"
    REDIS_PORT = 6379
    REDIS_DB = 0
    REDIS_EXPIRE = 60
    REDIS_PASSWORD = "password"

    # 微信支付初始化
    WECHAT_TOKEN = "token"
    WECHAT_APPID = getenv("WECHAT_APPID", "wx39b31687344772ce")
    WECHAT_SECRET = getenv("WECHAT_SECRET", "4770ecadde5efb82fa6bad7d0f7190d6")

    WECHAT_PAY_API_KEY = getenv(
        "WECHAT_PAY_API_KEY", "Beihaishirongmeitizhongxin202502"
    )
    WECHAT_PAY_MCH_ID = getenv("WECHAT_PAY_MCH_ID", "1707108052")
    WECHAT_PAY_SUB_MCH_ID = None
    WECHAT_PAY_MCH_CERT = path.join(certs_path, "apiclient_cert.pem")
    WECHAT_PAY_MCH_KEY = path.join(certs_path, "apiclient_key.pem")
